An electronic device, such as a cellular telephone, may include a touch screen display and a proximity sensor. The proximity sensor may be used to determine whether the cellular telephone is near a user's head. When not in proximity to the user's head, the cellular telephone may be placed in a normal mode of operation in which the touch screen display is used to present visual information to the user and in which a touch sensor functionality of the touch screen is enabled. In response to determining that the cellular telephone has been brought into the vicinity of the user's head, the display may be disabled to conserve power and the touch sensor on the display may be temporarily disabled to avoid inadvertent touch input from contact between the user's head and the touch sensor.
A proximity sensor for use in a cellular telephone may be based on an infrared light-emitting diode and a corresponding infrared light detector. During operation, the light-emitting diode may emit infrared light outwards from the cellular telephone. When the cellular telephone is not in the vicinity of a user's head, the infrared light will not be reflected towards the light detector and only small amounts of reflected light will be detected by the light detector. When, however, the cellular telephone is adjacent to the user's head, the emitted light from the infrared light-emitting diode will be reflected from the user's head and detected by the light detector.
Light-based proximity sensors such as these may be used to detect the position of a cellular telephone relative to a user's head, but can be challenging to operate accurately. If care is not taken, it can be difficult to determine when a user's head is in the vicinity of the cellular telephone, particularly when a user has hair that is dark colored and exhibits low reflectivity or when the proximity sensor has become smudged with grease from the skin of the user.